/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.onlineresortreservation.model;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.onlineresortreservation.beans.checkavail;
import org.onlineresortreservation.connection.DBConnection;

/**
 *
 * @author sony
 */
public class customer {
    
    public checkavail checkavailability(checkavail c)
    {
        try {
            DBConnection dbCon=new DBConnection();
            dbCon.connect();
            ResultSet rs;
            int count=0;
            Boolean a = null;
            rs=dbCon.customQuery("Select Distinct(RoomTypeId) from Room where RoomNo NOT IN (select RoomNo from bookingroom natural join booking natural join room  where (CheckInDate between '2012-10-9' and '2012-10-15') or (CheckOutDate between '2012-10-9' and '2012-10-15') or ('2012-10-9' between CheckInDate and CheckOutDate)  or ('2012-10-15' between CheckInDate  and  CheckOutDate))");
            while(rs.next()){
                count++;
                a=true;
                
            }
            if(count==1)
            {
                c.setava(a);
                rs.close();
                return c;
            }
        } catch (SQLException ex) {
            Logger.getLogger(customer.class.getName()).log(Level.SEVERE, null, ex);
        }
        return c;
        
    }
    public void addaddon(){
        
        
    }
    public void displayaddonroomwise(){
        try {
            DBConnection dbCon=new DBConnection();
            dbCon.connect();
            ResultSet rs;
            rs=dbCon.customQuery("select addons.addonname from addons,addontype where addons.addontypeid=(select addontypeid from addontype where addontypeid=2)");
            while(rs.next()){
                
            }
        } catch (SQLException ex) {
            Logger.getLogger(customer.class.getName()).log(Level.SEVERE, null, ex);
        }
           
        
    }
    public void displayaddonpersonwise(){
         try {
            DBConnection dbCon=new DBConnection();
            dbCon.connect();
            ResultSet rs;
            rs=dbCon.customQuery("select addons.addonname from addons,addontype where addons.addontypeid=(select addontypeid from addontype where addontypeid=1)");
            while(rs.next()){
                
            }
        } catch (SQLException ex) {
            Logger.getLogger(customer.class.getName()).log(Level.SEVERE, null, ex);
        }
       
        
    }
    
}
